package com.cuit.mimall.exception;

import com.cuit.mimall.common.R;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author star
 */
@ControllerAdvice
@ResponseBody
public class XmExceptionHandler {

    @ExceptionHandler(XmException.class)
    public R<?> handleException(XmException e) {
        ExceptionEnum em = e.getExceptionEnum();
        return R.fail(em.getCode(), em.getMsg());
    }
}
